<template>
  <div class="user-info">
    <!-- 个人信息 -->
    <el-form label-width="220px">
      <!--手机 -->

      <el-form-item label="手机">
        <el-input v-model="userInfo.mobile" style="width: 220px" />
      </el-form-item>

      <!-- 工号 入职时间 -->

      <el-form-item label="入职时间">
        <el-date-picker
          v-model="userInfo.timeOfEntry"
          type="date"
          class="inputW"
          value-format="yyyy-MM-dd"
        />
      </el-form-item>

      <!-- 员工照片 -->

      <el-form-item label="员工头像">
        <!-- 放置上传图片 -->
        <UploadImg :image-url.sync="userInfo.staffPhoto" @success="success" />
        <!-- <img :src="userInfo.staffPhoto" class="imgBox" /> -->
      </el-form-item>

      <!-- 保存个人信息 -->
      <el-form-item>
        <el-button type="primary" @click="upDate">保存更新</el-button>
        <el-button @click="$router.back()">返回</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
import mixin from '@/mixin/employees'

export default {
  name: 'UserInfo',
  mixins: [mixin],
  data() {
    return {
      userId: this.$route.query.id,
      userInfo: {
        mobile: '',
        timeOfEntry: '',
        staffPhoto: ''
      }
    }
  },
  computed: {},
  created() {
    console.log(this.userId)
    console.log(this.$store.state.user.userInfo.userId)
  },
  methods: {
    success(src) {
      this.userInfo.staffPhoto = src
    }
  }
}
</script>

<style lang="scss" scoped>
.user-info {
  padding-top: 20px;
}
</style>
